using System;
using System.Collections.Generic;
using System.Text;
using openfixfast;

namespace at_csharp
{
    class Program
    {
        static void Main(string[] args)
        {
            SessionSettings settings;
            FileStoreFactory storeFactory;
            ScreenLogFactory logFactory;
            //FileLogFactory logFactory;
            Acceptor acceptor;
            Initiator initiator;
            atApplication application;
            string file = args[0];
            try
            {
                settings = new SessionSettings(file);
                application = new atApplication();
                storeFactory = new FileStoreFactory(settings);
                //logFactory = new FileLogFactory(settings); //to file
                logFactory = new ScreenLogFactory(true, true, true);
                
                //initiator = new SocketInitiator(application, storeFactory, settings, logFactory);
                //initiator .start();
                //while (true) process_sleep(50);
                //initiator.stop();

                //initiator = new SocketSender(application, storeFactory, settings, logFactory);
                //initiator.start();
                //while (true) process_sleep(50);
                //initiator.stop();

                //acceptor = new SocketAcceptor(application, storeFactory, settings, logFactory);
                //acceptor.start();
                //while (true) System.Threading.Thread.Sleep(50);
                //acceptor.stop();

                acceptor = new SocketReceiver(application, storeFactory, settings, logFactory);
                acceptor.start();
                while (true) System.Threading.Thread.Sleep(50);
                acceptor.stop();
            }
            catch (Exception e)
            {
                System.Console.Write(e.Message);
            }
        }
    }
}
